package com.rui.patterns.mediator;

/**
 * @author : [锐神NO.3]
 * @version : [v1.0]
 * @className : MediatorStructure
 * @createTime : [2022/2/24 16:17]
 * @description : [具体的中介者角色类]
 */

public class MediatorStructure extends Mediator{

    /**
     * 聚合房主和租房者对象
     */
    private HouseOwner houseOwner;
    private Tenant tenant;;

    @Override
    public void constact(String messagem, Person person) {
        if(person == houseOwner){
            tenant.getMessage(messagem);
        }else {
            houseOwner.getMessage(messagem);
        }
    }

    public HouseOwner getHouseOwner() {
        return houseOwner;
    }

    public void setHouseOwner(HouseOwner houseOwner) {
        this.houseOwner = houseOwner;
    }

    public Tenant getTenant() {
        return tenant;
    }

    public void setTenant(Tenant tenant) {
        this.tenant = tenant;
    }
}
